package com.dragon.pear.api.perfect;

import com.chris.dev.base.libs.v1.http.params.NoneParam;
import com.chris.dev.base.libs.v1.http.protocols.HttpResult;
import com.chris.libs.http.x.v1.NetApi;
import com.dragon.pear.base.http.SuccessNetCallback;
import com.dragon.pear.base.http.DefaultRetrofit;
import com.dragon.pear.base.http.TokenUtil;
import com.dragon.pear.models.mock.MockUserItemResult;
import com.dragon.pear.models.mock.PageResult;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Header;
import retrofit2.http.POST;

/**
 * @author Chris Chan
 * Create on 2025-02-17 20:36
 * Use for: 模拟 接口调用
 * Explain: 标准模式
 * 不用在调用的时候构建Token和body
 * 底部附有使用方法
 */
public class MockApi extends NetApi {
    public static Service service = DefaultRetrofit.create("mock", Service.class);

    /**
     * 获取模拟数据
     *
     * @param params
     * @param callback
     */
    public static void getUserMockItemList(NoneParam params, SuccessNetCallback<PageResult<MockUserItemResult>> callback) {
        String token = TokenUtil.getAuthorization();
        RequestBody requestBody = postRequestObjBody(null, params);
        service.getUserMockItemList(token, requestBody).enqueue(callback);
    }

    public interface Service {
        // 获取用户信息
        @POST("getUserMockItemList")
        Call<HttpResult<PageResult<MockUserItemResult>>> getUserMockItemList(@Header("Authorization") String token, @Body RequestBody body);
    }
}
